package com.xing.service.impl;

import com.xing.dao.SystemRoleMapper;
import com.xing.entity.pojo.SystemRole;
import com.xing.service.SystemRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemRoleServiceImpl implements SystemRoleService {
    @Autowired
    private SystemRoleMapper systemRoleMapper;
    @Override
    public List<SystemRole> findNameAll() {
        return systemRoleMapper.findNameAll();
    }

    @Override
    public SystemRole selectByPrimaryKey(String roleId) {
        return   systemRoleMapper.selectByPrimaryKey(roleId);
    }

    @Override
    public List<SystemRole> findAll() {
        return systemRoleMapper.findAll();
    }

    @Override
    public int insertSelective(SystemRole record) {
        return systemRoleMapper.insertSelective(record);
    }

    @Override
    public int deleteByPrimaryKey(String roleId) {
        return systemRoleMapper.deleteByPrimaryKey(roleId);
    }

    @Override
    public int updateByPrimaryKey(SystemRole record) {
        return systemRoleMapper.updateByPrimaryKey(record);
    }

    @Override
    public Boolean deleteSelectedRole(String[] ids) {
        boolean flag=false;
        for (String id : ids) {
            int i1 = systemRoleMapper.deleteByPrimaryKey(id);
            flag = i1 > 0;
        }
        return flag;
    }


}
